﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using ReferralTracker.Data.Entities;
using ReferralTracker.Data.Entities.Configurations;

namespace ReferralTracker.Data.Contexts {
    public class ReferralTrackerContext : DbContext, IContext {

        public ReferralTrackerContext() : base("ReferralTrackerConnection") { }

        public DbSet<User> Users { get; set; }
        public DbSet<UserDetail> UserDetails { get; set; }
        public DbSet<Referral> Referrals { get; set; }
        public DbSet<ReferralSite> ReferralSites { get; set; }

        public new IDbSet<TEntity> Set<TEntity>() where TEntity : class {
            return base.Set<TEntity>();
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder) {
            modelBuilder.Configurations.Add(new UserDetailConfiguration());
            modelBuilder.Configurations.Add(new ReferralConfiguration());
        }
    }
}
